/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controlador.controller;

/**
 * 
 * @author Emerson
 */

class JParallelPort {

	static class ParallelPort {

		ParallelPort lpt1;
		int aByte;

		public ParallelPort() {
			lpt1 = new ParallelPort(0x378); // 0x378 is normally
											// the base address
											// for the PT1 port
			aByte = lpt1.read(); // read a byte from the port's STATUS pins
			System.out.println("Input from parallel port: " + aByte);
			aByte = aByte >> 2; // a simple and irrelevant operation
			lpt1.write(aByte); // write a byte to the port's DATA pins
			System.out.println("Output to port: " + aByte);
		}

		private ParallelPort(int i) {
			throw new UnsupportedOperationException("Not yet implemented");
		}

		private int read() {
			return lpt1.read(); // read a byte from the port's STATUS pins			
		}

		private void write(int aByte) {
			lpt1.write(aByte); // write a byte to the port's DATA pins			
		}
	}

}

/**
 * class SimpleIO { public static void main ( String []args ) {
 */

/**
 * JParallelPort parport = new JParallelPort(); // instantiate ParallelPort
 * object try { parport.open(); // open port
 * 
 * // write 0 value to data pins (usually 0x378) put all pins to low
 * parport.writeData((byte) 0);
 * 
 * // write 0 value to control pins (usually 0x37a) put C0, C1 and C3 // to high
 * // and C2 to low parport.writeControl((byte) 0);
 * 
 * // read from status and print it as an integer System.out.println("Status: "
 * + (int) parport.readStatus());
 * 
 * parport.close(); // close port } catch (IOException e) {
 * System.out.println("Error: " + e.getMessage()); }
 * 
 * private void open() { throw new
 * UnsupportedOperationException("Not yet implemented"); }
 * 
 * private void writeData(byte b) { throw new
 * UnsupportedOperationException("Not yet implemented"); }
 * 
 * private void writeControl(byte b) { throw new
 * UnsupportedOperationException("Not yet implemented"); }
 * 
 * private void close() { throw new
 * UnsupportedOperationException("Not yet implemented"); }
 */

